<?php
/**
 * Created by PhpStorm.
 * User: freethy
 * Date: 2018-05-11
 * Time: 9:49
 */

namespace app\self;
use think\cache\driver\Redis;
use think\Request;

class Auth
{
    public function run(&$params)
    {
        return;

        $redis = new Redis();
        $token = $redis->get(get_user_id());
        $token_qian = input('token');
        $token = 1;
//        header("location: ".url('@bus/index/index'));

//        echo $token;
//        echo'<br>';
//        echo $token_qian;die;s
        if($token !== $token_qian && !empty($token_qian) || empty($token)){
            $redis = new Redis();
            $redis->clear(get_user_id());
            session('MAP_USER', null);
            session_destroy();
            die();
            $json = json_encode(array('code' => 403, 'text' => '尚未登录或登录超时'),JSON_UNESCAPED_UNICODE);

        }




        //没有登录
        if(!isset($user)){
            $json = json_encode(array('code' => 403, 'text' => '尚未登录或登录超时'),JSON_UNESCAPED_UNICODE);
            echo $json;
            die();
        }

    }
}